Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collectors: add startup time metrics #108

Merged
merged 2 commits into from
Jul 23, 2024
Merged

Conversation

djkazic
Copy link
Contributor

@djkazic djkazic commented Jun 26, 2024

Today we don't track LND startup time. This modification records a start and end time for state transitions from RPC_ACTIVE to SERVER_ACTIVE (the bulk of startup time), then makes a prometheus gauge metric which will get picked up on the next scrape.

Edit: it would probably be helpful to make lndmon itself state-aware and not try to do any other scrapes until we see SERVER_ACTIVE.

@djkazic djkazic self-assigned this Jun 26, 2024
collectors/state_collector.go Outdated Show resolved Hide resolved
@djkazic djkazic force-pushed the startup-time-monitoring branch 4 times, most recently from 7d39d0d to bac6bda Compare June 27, 2024 02:16
@djkazic
Copy link
Contributor Author

djkazic commented Jun 27, 2024

lndmon is now tolerant of LND not being unlocked yet.

@djkazic djkazic changed the title [HOLD] collectors: add StateCollector collectors: add startup time metrics Jul 17, 2024
@djkazic djkazic marked this pull request as ready for review July 17, 2024 18:32
@lightninglabs-deploy
Copy link

@djkazic, remember to re-request review from reviewers when ready

collectors/state_collector.go Show resolved Hide resolved
collectors/state_collector.go Show resolved Hide resolved
collectors/state_collector.go Outdated Show resolved Hide resolved
lndmon.go Show resolved Hide resolved
collectors/prometheus.go Outdated Show resolved Hide resolved
collectors/state_collector.go Outdated Show resolved Hide resolved
@djkazic
Copy link
Contributor Author

djkazic commented Jul 18, 2024

Will address comments tomorrow 👍🏻 but yep I can defo refactor

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🧿

func (s *StateCollector) monitorStateChanges() {
var serverActiveReached bool

stateUpdates, errChan, err := s.lnd.State.SubscribeState(context.Background())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Roasbeef Roasbeef merged commit 892dae7 into master Jul 23, 2024
1 check passed
@guggero guggero deleted the startup-time-monitoring branch July 24, 2024 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants